<?php

/*
 * Action - Attack 5$
 *
 * Gain a Gold. Each other player gains a Curse. Each player who did draws a card.
 * 
 */

class Soothsayer extends Card implements iAction, iKingdom, iGuilds, iAttack {

    public function __construct() {
        parent::__construct("Soothsayer", 5);
        $this->undoPlay = false;
        $this->undoBuy = false;
    }

    public function getDescription() {
        return array(
            "Gain a Gold. Each other player gains a Curse. Each player who did draws a card.");
    }

    public function play(Game $game, $isRealCard) {
        $temp_gold = new Gold();
        $gold = $game->moveCardFromPileToPile($temp_gold, BoardCards, DiscardPile);
        ScreenDisplay::addScreenMessage($game, true, "gain " . nicePrint($gold), "gains " . ScreenDisplay::$LMSG);

        $game->attack($this);

        $names = $game->getOtherPlayersNames(true);
        foreach ($names as $name) {
            $curse = $game->moveCardFromPileToPile("Curse", BoardCards, DiscardPile, $name);
            ScreenDisplay::addScreenMessage($game, true, "gain  " . nicePrint($curse), "gains " . ScreenDisplay::$LMSG, $name);
            if ($curse) {
                $drawed_card = $game->drawCards(1, $name);
                if ($drawed_card) {
                    ScreenDisplay::addScreenMessage($game, false, " and draw " . nicePrint($drawed_card), " and draws " . sizeof($drawed_card) . " cards", $name);
                }
                else {
                    ScreenDisplay::addScreenMessage($game, false, " and draw nothing", " and draws nothing", $name);
                }
            }
        }
        $game->cardActionFinished();
        return true;
    }
}

?>